package com.example.biyesheji;

import org.apache.spark.api.java.JavaSparkContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

@SpringBootApplication
public class BiyeshejiApplication {

    public static void main(String[] args) {
        SpringApplication.run(BiyeshejiApplication.class, args);
    }


    //sse实时推送对象服务
    @Bean(name = "getExecutorService")
    public ScheduledExecutorService getExecutorService(){
        return Executors.newSingleThreadScheduledExecutor();
    }

    //生产bean记载sparkContext
    @Bean(name = "sc")
    public JavaSparkContext makeSparkContext(){
        return new JavaSparkContext("local", "spark-container");
    }


}
